import { Exclude, Transform } from 'class-transformer'
import { GenderCN } from '@/common/enums'

export class UserSerialize {
  id: number

  userId: string

  username: string

  @Exclude()
  password: string

  @Transform(({ value }) => (value === null ? null : GenderCN[value]))
  gender: number

  age: number

  mobile: string

  constructor(partial: Partial<UserSerialize>) {
    Object.assign(this, partial)
  }
}
